import request from '@/utils/request'

/**
 * @description: 新增部门
 * @param {code,introduce,manager,name,pid} data
 * @return {*}
 */
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * @description: 查询企业部门列表
 * @param {*}
 * @return {*}
 */
export function getDepartment(data) {
  return request({
    url: '/company/department'
  })
}

/**
 * @description: 根据ID修改部门详情
 * @param {code,introduce,manager,name,pid,id} data
 * @return {*}
 */
export function updateDepartment(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * @description:根据ID删除部门
 * @param {id}
 * @return {*}
 */
export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * @description: 根据ID查询部门详情
 * @param {id}
 * @return {*}
 */
export function infoDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'
  })
}
